﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using DAL;

namespace Crad.Controllers
{
    public class HomeController : Controller
    {


        //登陆页面
        public ActionResult Login()
        {
            return View();
        }
        CardEntities db = new CardEntities();


        //验证管理员
        public ActionResult VerifyAdmin(string account, string pwd)
        {
            Admin admin = db.Admin.FirstOrDefault(s => s.Account.Equals(account) && s.Pwd.Equals(pwd));
            if (admin == null)
            {
                ViewBag.info = "账号密码错误";
                return Redirect("~/Home/Login");
            }
            else
            {
                Session["Admin"] = admin;
                return Redirect("~/AdminPage/PageHome");
            }
        }
    }
}